package cn.bluedot.common.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * redis 操作数据库配置类
 * 
 */
public class JedisPoolCacheUtils {

	public final static String DATA_REDIS_KEY = "data_";

	/**
	 * redis过期时间,以秒为单位
	 */
	public final static int EXRP_HOUR = 60 * 60; // 一小时
	public final static int EXRP_HALF_DAY = 60 * 60 * 12; // 半天
	public final static int EXRP_DAY = 60 * 60 * 24; // 一天
	public final static int EXRP_MONTH = 60 * 60 * 24 * 30; // 一个月

	private static JedisPool jedisPool = null;

	static {
		JedisPoolConfig config = new JedisPoolConfig();
		config.setMaxTotal(10);
		String host = "39.105.179.229";
		int port = 6379;
		int timeOut = 1000;
		String password = "123456abc";
		jedisPool = new JedisPool(config, host, port, timeOut, password);
	}

	public static Jedis getResource() {
		return jedisPool.getResource();
	}

}
